/**
 * 
 */
package org.manekineko.regras;

import java.util.ArrayList;
import java.util.List;

/**
 * @author josen
 * 
 */
public class RegraParesImpares implements Regra {

	/*
	 * (non-Javadoc)
	 * 
	 * @see daikoku.Regra#aplicar(java.util.List)
	 */
	@Override
	public void aplicar(List<Integer[]> p) {

		List<Integer[]> toRemoveList = new ArrayList<Integer[]>();

		for (int i = 0; i < p.size(); i++) {
			int countPares = 0;
			// System.out.println(prognosticos.get(i));
			for (int k = 0; k < p.get(i).length; k++) {
				if ((p.get(i)[k] % 2) == 0) {
					++countPares;
				}
			}

			if (countPares < 3) {
				toRemoveList.add(p.get(i));
			}
		}

		p.removeAll(toRemoveList);
	}

	public static void main(String[] args) {
		RegraParesImpares rpi = new RegraParesImpares();

		List<Integer[]> p = new ArrayList<Integer[]>();
		p.add(new Integer[] { 6, 16, 17, 21, 22, 35 });
		p.add(new Integer[] { 1, 11, 34, 43, 53, 54 });
		p.add(new Integer[] { 5, 33, 34, 43, 53, 54 });
		p.add(new Integer[] { 1, 3, 5, 7, 9, 11 });

		rpi.aplicar(p);
		
		for (Integer[] dezenas : p) {
			for (int i = 0; i < dezenas.length; i++) {
				System.out.print(dezenas[i] + ",");
			}
		}
		

	}
}
